import React, {useState} from 'react';
 
let value = 0;          // 定义在组件外的value
 
function Test() {
  const [state, setState] = useState(0); // state
  function testClick() {  // 每次点击，希望让value、state加一。
      console.log(++value);
      setState(state+1);
  }
 
  return (
    <div>
      <button onClick={testClick}>Example 1</button>
      <p>state is {state}</p>
    </div>
  );
}
export default Test;